<template>
  <div class="exhibits-content" :style="{ width: props.info.width + 'rem', height: props.info.height + 'rem' }">
    <div
      class="decorate"
      :style="{
        'background-image': `url(${publicUrls + 'free/style6/exhibitionStandStyle1zs.webp'})`,
      }"
    ></div>
    <div class="item-content">
      <img class="boardleft" :src="publicUrls + 'free/style6/stand1Left.webp'" alt="" />
      <div
        @contextmenu.stop="emit('onContextMenuChild', $event, index)"
        v-for="(item, index) in props.info.showpieceList"
        :key="index"
        class="item-parent"
      >
        <div class="exhibits-item" @click="viewImg(item.moduleId, item.id)">
          <div class="items-title">
            <p>{{ item.name }}</p>
          </div>
          <div class="cover-box">
            <img class="cover" :src="getLinkUrl(item.coverUrl,'?imageView2/3/w/600/format/webp')" alt="" />
            <img v-if="route.meta.loopType" class="flower-btn" :src="publicUrls + 'free/style6/flower.webp'" />
          </div>
        </div>
      </div>
      <img class="boardleft" :src="publicUrls + 'free/style6/stand1Right.webp'" alt="" />
    </div>
  </div>
</template>

<script lang="ts">
export default defineComponent({
  name: 'free6Style1',
});
</script>

<script setup lang="ts">
import { publicUrls } from '@/utils/minxin';
import { DraggableContainer } from 'vue3-draggable-resizable';
// import FlotMenu from '@/components/flotMenu/OutlineMenu.vue';
import ContextMenu from '@imengyu/vue3-context-menu';
import { getDraggableNumber, getExhibitsHeightRest, getdisabledY } from '@/utils/getRemComputed';
import { ref, reactive, watch, nextTick, defineComponent } from 'vue';
import { exbitMenuShow, exbitListMenuShow } from '@/hooks/menuHooks';
import { useProjectStore } from '@/store';
import { getLinkUrl } from '@/utils/request/upload';
import { useRoute } from 'vue-router';

const emit = defineEmits([
  'emitChildItemDraggable',
  'emitChildItemDraggableStyle',
  'emitShowcaseDraggable',
  'emitShowcaseDraggableStyle',
  'onContextMenuChild',
]);
const store = useProjectStore();
const contextMenuTrigger = ref(); //列表盒子dom
const parentLock = ref(true);
const childShow = ref(true);
const draggableResizable = ref(); //父级拖拽盒子ref
const route = useRoute();
const timer = ref();
const ImgVisible = ref(false);
const ImgUrl = ref('');

const props = defineProps({
  width: {
    type: Number || String,
  },
  height: {
    type: Number || String,
  },
  indexs: {
    type: Number,
  },
  info: {
    type: Object,
  },
  childId: {
    type: Number,
  },
  AuxiliaryId: {
    type: Number,
  },
});

const viewImg = (moduleId: number, e?: number) => {
  store.exhibitsModuleId = moduleId;
  store.exhibitsShowpieceid = e;
  store.exhibitsInfoShow = true;
};

const handleMouseDown = (event) => {
  event.stopPropagation();
};
const preventDefaultDrag = (event) => {
  event.stopPropagation();
};
// watch(
//   () => props.info.width,
//   () => {
//     childShow.value = false;
//     nextTick(() => {
//       childShow.value = true;
//     });
//   },
//   { deep: true },
// );
// watch(
//   () => props.info.height,
//   () => {
//     childShow.value = false;
//     nextTick(() => {
//       childShow.value = true;
//     });
//   },
//   { deep: true },
// );

//
</script>

<style lang="less" scoped>
.exhibits-content {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  z-index: 999;
  padding: 0 !important;
  // -webkit-box-reflect: below 0% linear-gradient(transparent, rgba(0, 0, 0, 0.5));
}

.active {
  :deep(.flot-menu) {
    display: flex;
  }
}
:deep(.active) {
  z-index: 999;
}
:deep(.vdr-handle) {
  z-index: 66;
}
.item-content {
  height: 100%;
  display: flex;
  align-items: end;
  justify-content: center;
  -webkit-box-reflect: below 0% linear-gradient(transparent, rgba(0, 0, 0, 0.15));
}
.boardleft {
  height: 641px;
  object-fit: contain;
}
.item-parent {
  width: 190px;
  height: 641px;
  background: url('https://static.jiyi.show/free/style6/exhibitionStandStyle1Bg.png') no-repeat center/100% 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding-bottom: 20px;
  .exhibits-item {
    width: 100%;
    height: 260px;
    display: flex;
    justify-content: center;
    align-items: center;
    padding-right: 12px;
    position: relative;
    &:hover .items-title {
      opacity: 1;
    }
    &:hover .flower-btn {
      display: none;
    }
    &:hover .cover-box > .cover {
      transform: scale(1.2);
    }
    .cover-box {
      width: 156px;
      height: 226px;
      position: relative;
      overflow: hidden;
      .cover {
        width: 100%;
        height: 100%;
        object-fit: contain;
        transition: all 0.5s ease;
      }
      .flower-btn {
        width: 50px;
        height: 50px;
        object-fit: cover;
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        animation: flower 2s linear infinite;
        @keyframes flower {
          0% {
            opacity: 0;
          }
          40% {
            opacity: 100%;
          }
          60% {
            opacity: 100%;
          }
          100% {
            opacity: 0;
          }
        }
      }
    }
    .items-title {
      width: 157px;
      height: 261px;
      position: absolute;
      left: 32%;
      top: 50%;
      transform: translate(-32%, -50%);
      padding: 0 14px;
      background: url('https://static.jiyi.show/free/style6/exhibitionStandStyle1Shadow.png') no-repeat center/100% 100%;
      display: flex;
      justify-content: center;
      align-items: center;
      opacity: 0;
      transition: all 0.3s;
      z-index: 12;
      p {
        color: #efede9;
        font-size: 18px;
        line-height: 24px;
        font-family: SourceHanSerifCN-Bold;
        overflow: hidden;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        text-align: center;
      }
    }
  }
}
.decorate {
  width: 402px;
  height: 727px;
  background-size: 100% 100%;
  background-repeat: no-repeat;
  margin-right: 76px;
  -webkit-box-reflect: below -40% linear-gradient(transparent, rgba(0, 0, 0, 0.1));
}
</style>
